<?php
$username=$_POST['username'];
    if ("3"<strlen($username)&&strlen($username)<"10"){
         $mysqli=mysqli_connect('localhost','root','root','user');
         $select="select * from user1 where username='$username'";
         $obj=mysqli_query($mysqli,$select);
         $arr=mysqli_fetch_array($obj);
        if (count($arr)>0){
            echo 1;//账号已存在
        }else{
            echo 2;//可以注册
        }
    }else{
        echo 0;//账号 格式不对
    }
            //if (isset($_POST['sub'])) { } else{echo 2; }
            //if("3"<strlen($_POST['password']))
            //$into="insert into (username,password,datetime,rand) values('$username','$password','$time','$rand')";
       // }

?>